<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../../views/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改专家信息</title>
<head>
<meta charset="utf-8">
<title>修改专家信息</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">

<link rel="stylesheet"
	href="/fdoctor-ms/statics/beginnerAdmin/plugins/layui/css/layui.css"
	media="all" />
<link rel="stylesheet"
	href="/fdoctor-ms/statics/beginnerAdmin/plugins/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet"
	href="/fdoctor-ms/statics/beginnerAdmin/css/btable.css" />
<link rel="stylesheet"
	href="/fdoctor-ms/statics/css/global.css" />
<link rel="stylesheet"
	href="/fdoctor-ms/statics/ztree/css/metroStyle/metroStyle.css" />
<link rel="stylesheet"
	href="/fdoctor-ms/statics/ztree/css/demo.css" />

<script type="text/javascript"
	src="/fdoctor-ms/statics/beginnerAdmin/plugins/layui/layui.js"></script>
<script type="text/javascript"
	src="/fdoctor-ms/statics/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="/fdoctor-ms/statics/js/inputTools.js"></script>
<script type="text/javascript" src="/fdoctor-ms/statics/ztree/js/jquery.ztree.core.min.js"></script>
<script type="text/javascript" src="/fdoctor-ms/statics/ztree/js/jquery.ztree.excheck.min.js"></script>
<%
	String webServerIp = PropertiesUtils.getValue("ftp_web_server_ip");
%>
</head>

<body>

	<fieldset class="layui-elem-field layui-field-title"
		style="margin-top: 5px; margin-left: 5px; margin-right: 5px">
		<legend>修改专家信息 </legend>
	</fieldset>
	<input type="hidden" id="webServerIp" value="<%=webServerIp%>">
	<form class="layui-form" action="" id="dataForm">
		
		<div class="layui-form-item" style="width: 100%">
			<input name="id" class="layui-input" type="hidden" id="id" value="${expertVo.id}">
			<input name="expertAccountId" class="layui-input" type="hidden" id="expertAccountId" value="${expertVo.expertAccountId}">
			<div class="layui-inline" style="width: 41%">
				<div class="layui-form-item" style="width: 100%">
					<label class="layui-form-label">专家姓名:</label>
					<div class="layui-input-block">
						<input name="expertName" class="layui-input" type="text" id="expertName" value="${expertVo.expertName}">
					</div>
				</div>
				<div class="layui-form-item" style="width: 100%">
					<label class="layui-form-label" >性别:</label>
					<div class="layui-input-block">
						<select name="sex" id="sex" lay-verify="" >
							<option value="1" <c:if test="${'1' eq expertVo.sex}">selected</c:if>>男</option>
							<option value="2" <c:if test="${'2' eq expertVo.sex}">selected</c:if>>女</option>
						</select> 
					</div>
				</div>
				<div class="layui-form-item" style="width: 100%">
					<label class="layui-form-label">电话号码:</label>
					<div class="layui-input-block">
				      <input name="phoneNumber" class="layui-input" type="text" id="phoneNumber" value="${expertVo.phoneNumber}">
				    </div>
				</div>
				<div class="layui-form-item" style="width: 100%">
					<label class="layui-form-label">账号:</label>
					<div class="layui-input-block">
				      <input name="userName" class="layui-input" type="text" id="userName" value="${expertVo.userName}">
				    </div>
				</div>
				<div class="layui-form-item" style="width: 100%">
					<label class="layui-form-label">身份证号:</label>
					<div class="layui-input-block">
				      <input name="idCard" class="layui-input" type="text" id="idCard" value="${expertVo.idCard}" lay-verify="required" >
				    </div>
				</div>
				
			</div>
			
			<div class="layui-inline" style="width: 41%">
				
				
				<div class="layui-form-item" style="width: 100%">
					<label class="layui-form-label">职称:</label>
					<div class="layui-input-block">
						<input name="title" class="layui-input" type="text" id="title" value="${expertVo.title}">
					</div>
				</div>
				<div class="layui-form-item" style="width: 100%">
					<label class="layui-form-label">所属医院</label>
					<div class="layui-input-block">
						<select name="orgId" lay-verify="" id="orgId" lay-filter="orgId">
					  <option value="0">--请选择--</option>
				      	<c:forEach items="${hospitalList}" var="item">
				      		<option value="${item.id}" <c:if test="${item.id eq expertVo.orgId}">selected</c:if>>${item.orgName}</option>
				      	</c:forEach>
					</select> 
					</div>
				</div>
				<div class="layui-form-item" style="width: 100%">
					<label class="layui-form-label">所属科室:</label>
					<div class="layui-input-block">
						<ul>
							<li class="title"><!-- <input id="deptSel" type="text" readonly value="" class="layui-input" onclick="showMenu();" /> -->
								<input name="deptSel" class="layui-input" type="text" id="deptSel" value="${expertVo.department}">
							</li>
						</ul>
					</div>
				</div>
				<div class="layui-form-item" style="width: 100%">
					<label class="layui-form-label">密码:</label>
					<div class="layui-input-block">
				      <input name="password" class="layui-input" type="text" id="password" value="${expertVo.password}">
				    </div>
				</div>
				<div class="layui-form-item" style="width: 100%">
					<label class="layui-form-label">执业证号:</label>
					<div class="layui-input-block">
				      <input name="practisingCertificateNumber" class="layui-input" type="text" id="practisingCertificateNumber" value="${expertVo.practisingCertificateNumber}" lay-verify="required" >
				    </div>
				</div>
			</div>
		</div>
			<div class="layui-form-item" style="width: 84.5%">
				<label class="layui-form-label">资格证号:</label>
				<div class="layui-input-block">
				    <input name="qualificationNumber" class="layui-input" type="text" id="qualificationNumber" value="${expertVo.qualificationNumber}" lay-verify="required" >
				</div>
			</div>
			<div class="layui-form-item" style="width: 84.5%">
				<label class="layui-form-label">擅长领域:</label>
				<div class="layui-input-block">
					<input name="specialty" class="layui-input" type="text" id="specialty" value="${expertVo.specialty}">
				</div>
			</div>
			<div class="layui-form-item" style="width: 84.5%">
				<label class="layui-form-label">医生简介:</label>
				<div class="layui-input-block">
					<textarea placeholder="请输入内容" class="layui-textarea" id="introduction">${expertVo.introduction}</textarea>
				</div>
			</div>
		</div>
		
		<hr>
	  <div align="center">
	  		<button class="layui-btn layui-btn-big layui-btn-primary layui-btn-radius" type="button" id="saveButton"><i class="layui-icon">&#xe618;</i>确认保存</button>
	  </div>
	</form>


<div id="menuContent" class="menuContent" style="display:none; position: absolute;">
	<ul id="deptTree" class="ztree"></ul>
</div>

</body>
<script type="text/javascript">
	//初始化表单控件
	layui.use(
		[ 'jquery', 'form', 'laydate','upload' ],
		function() {
			$ = layui.jquery;
			form = layui.form();
			var laydate = layui.laydate;
	
			$('#saveButton').on('click', function(){
				if($('#expertName').val() == null || $('#expertName').val() == ''){
					layer.msg('请输入医生姓名！',{icon: 7});
		    		return;
				}
				if($('#orgId').val() == null || $('#orgId').val() == ''){
					layer.msg('请选择医院！',{icon: 7});
		    		return;
				}
				if($('#deptSel').val() == null || $('#deptSel').val() == ''){
					layer.msg('请输入科室！',{icon: 7});
		    		return;
				}
				if($('#userName').val() == null || $('#userName').val() == ''){
					layer.msg('请输入账号！',{icon: 7});
		    		return;
				}
				if($('#password').val() == null || $('#password').val() == ''){
					layer.msg('请输入密码！',{icon: 7});
		    		return;
				}
				if($('#userName').val().match(/^[a-zA-Z0-9]+$/)==null){
					layer.msg('账号只能为数字或字母！',{icon: 7});
		    		return;
				}
				if($('#password').val().match(/^[a-zA-Z0-9]+$/)==null){
					layer.msg('密码只能为数字或字母！',{icon: 7});
		    		return;
				}
				if($('#idCard').val() == null || $('#idCard').val() == ''){
					layer.msg('请输入身份证！',{icon: 7});
		    		return;
				}
				if($('#qualificationNumber').val() == null || $('#qualificationNumber').val() == ''){
					layer.msg('请输入资格证号！',{icon: 7});
		    		return;
				}
				if($('#practisingCertificateNumber').val() == null || $('#practisingCertificateNumber').val() == ''){
					layer.msg('请输入职业证号！',{icon: 7});
		    		return;
				}
				
				layer.confirm('确认修改？', {icon: 3,id : Math.ceil(100)}, function(index){
					
        			$.ajax({
			 			type : 'POST',
			 			url : '/fdoctor-ms/expert/updateExpert',
			 			data : {
			 				id : $('#id').val(),
			 				expertAccountId: $('#expertAccountId').val(),
			 				expertName : $('#expertName').val(),
			 				phoneNumber : $('#phoneNumber').val(),
			 				title : $('#title').val(),
			 				orgId : $('#orgId').val(),
			 				sex : $('#sex').val(),
			 				specialty : $('#specialty').val(),
			 				introduction : $('#introduction').val(),
			 				department : $('#deptSel').val(),
			 				userName : $('#userName').val(), 
			 				password : $('#password').val(),
			 				idCard : $('#idCard').val(),
			 				qualificationNumber : $('#qualificationNumber').val(),
			 				practisingCertificateNumber : $('#practisingCertificateNumber').val()
			 			},
			 			success : function(data) {
			 				if(data.code == 200){
			 					var index = parent.layer.getFrameIndex(window.name);
			 					parent.layer.close(index);
			 					parent.layer.msg('修改成功！',{icon: 1});
			 					parent.tableConfig();
			 				}else{
			 					parent.layer.msg('修改失败！'+data.msg,{icon: 2});
			 				}
			 			}
			 		});
       			});
			})
		});
</script>
</html>